﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using DAL;
namespace UI
{
    public partial class index1 : System.Web.UI.Page
    {
        public List<NewsInfo> newslist = new List<NewsInfo>();
        public List<ProductInfo> productlist = new List<ProductInfo>();
        public List<ImgInfo> imglist = new List<ImgInfo>();
        public List<AdInfo> adlist = new List<AdInfo>();
        public NewsInfo newinfo = new NewsInfo();
        public string m1 = "", m2 = "", m3 = "", m4 = "";
        public string p1 = "", p2 = "", p3 = "", p4 = "", p5 = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            newslist = NewsDAL.FindTop(10);
            productlist = ProductDAL.FindTop();
            imglist = ImgDAL.FindTop();
            adlist = AdDAL.FindTop(5);
            newinfo = NewsDAL.FindOneById(1);
            this.Page.Header.Title = newinfo.name;
            this.Page.MetaKeywords = newinfo.img;
            this.Page.MetaDescription = newinfo.context;
            p1 = B.Instance<ProductInfo>(productlist.FirstOrDefault(x => x.positions == 1)).vpath;
            p2 = B.Instance<ProductInfo>(productlist.FirstOrDefault(x => x.positions == 2)).vpath;
            p3 = B.Instance<ProductInfo>(productlist.FirstOrDefault(x => x.positions == 3)).vpath;
            p4 = B.Instance<ProductInfo>(productlist.FirstOrDefault(x => x.positions == 4)).vpath;
            p5 = B.Instance<ProductInfo>(productlist.FirstOrDefault(x => x.positions == 5)).vpath;
            
            m1 = B.Instance<ImgInfo>(imglist.FirstOrDefault(x => x.positions == 1)).vpath;
            m2 = B.Instance<ImgInfo>(imglist.FirstOrDefault(x => x.positions == 2)).vpath;
            m3 = B.Instance<ImgInfo>(imglist.FirstOrDefault(x => x.positions == 3)).vpath;
            m4 = B.Instance<ImgInfo>(imglist.FirstOrDefault(x => x.positions == 4)).vpath;
        }
    }
}